/*******************************************************************************
  * @file    io.h
  * @author  chumanhcuong@hlab.com.vn
  * @version V1.0
  * @date    26-05-2012
  * @brief   This library support for GT2
  ******************************************************************************/
	
#include "stm32f10x.h"
#define IOm			4
#define IO_NULL 0xff
typedef enum{BUT1=0,BUT2,BUT3,LCD_DETECT,TRIGGER_1_CHANNEL,TRIGGER_2_CHANNEL,TRIGGER_3_CHANNEL,
             IO_LIMIT}InOutTypeDef;
/**
 * @brief Input/Output Define
 */
/* define of input */
#define BUT1_PIN                    GPIO_Pin_13	
#define BUT1_PORT                   GPIOB
#define BUT1_CLK                    RCC_APB2Periph_GPIOB 

#define BUT2_PIN                    GPIO_Pin_14	
#define BUT2_PORT                   GPIOB
#define BUT2_CLK                    RCC_APB2Periph_GPIOB 

#define BUT3_PIN                    GPIO_Pin_15	
#define BUT3_PORT                   GPIOB
#define BUT3_CLK                    RCC_APB2Periph_GPIOB

#define LCD_DETECT_PIN 							GPIO_Pin_0	
#define LCD_DETECT_PORT             GPIOA
#define LCD_DETECT_CLK              RCC_APB2Periph_GPIOA 

#define TRIGGER_1_PIN                    GPIO_Pin_5	
#define TRIGGER_1_PORT                   GPIOB
#define TRIGGER_1_CLK                    RCC_APB2Periph_GPIOB 

#define TRIGGER_2_PIN                    GPIO_Pin_6
#define TRIGGER_2_PORT                   GPIOB
#define TRIGGER_2_CLK                    RCC_APB2Periph_GPIOB 

#define TRIGGER_3_PIN                    GPIO_Pin_7	
#define TRIGGER_3_PORT                   GPIOB
#define TRIGGER_3_CLK                    RCC_APB2Periph_GPIOB 
/******************************************************************************
** Function name: GSM_ServiceInit()
** Description: This function shall be init  io pin
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_init(InOutTypeDef PIN_SEL);   //IO init
/******************************************************************************
** Function name: IO_read()
** Description: This should be set bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: value of pin 0 or 1
** Remarks: global variables used, side effects
******************************************************************************/
uint8_t IO_read(InOutTypeDef PIN_SEL);    // IO read
/******************************************************************************
** Function name: IO_set()
** Description: This should be set bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_set(InOutTypeDef PIN_SEL);    //IO set
/******************************************************************************
** Function name: IO_clr()
** Description: This should be clear bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_clr(InOutTypeDef PIN_SEL);    //IO clear bit
